#include <bits/stdc++.h>
using namespace std;

// #define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

typedef long long LL;

int n;

const int N = 2e5+50;

unordered_map<int, LL> mp;

char s[N];

int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	int bx;
	for (int i=0; i<n; ++i)
	{
		scanf("%d", &bx);
		mp[bx - i] += bx;
	}
	LL ans = 0;
	for (const auto &p : mp)
	{
		ans = max(ans, p.second);
	}
	printf("%lld\n", ans);
	return 0;
}